package com.foreknow.elmboot.mapper;


import com.foreknow.elmboot.po.Orders;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;

import java.util.List;

@Mapper
public interface OrdersMapper {
    /**
     *
     * @param orders
     * @return
     */
    @Insert("insert into orders ( userId, businessId, orderDate, orderTotal, daId, orderState ) values(#{userId},#{businessId},#{orderDate},#{orderTotal},#{daId},0)")
    @Options(useGeneratedKeys = true,keyProperty = "orderId",keyColumn = "orderId")
    int saveOrders(Orders orders);
    /**
     * 根据orderId订单信息
     * @param orderId
     * @return
     *
    */
    public Orders getOrdersById(Integer orderId);
    /**
     * 根据userId查询订单列表
     * @param userId
     * @return
     */
    public List<Orders>listOrdersByUserId(String userId);

}
